home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / lpc10 / irc2pc.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  934b  |  48 lines

  1. /******************************************************************
  2. *
  3. *    IRC2PC Version 48
  4. *
  5. ******************************************************************
  6. *
  7. *   Convert Reflection Coefficients to Predictor Coeficients
  8. *
  9. * Inputs:
  10. *  RC     - Reflection coefficients
  11. *  ORDER  - Number of RC's
  12. *  GPRIME - Excitation modification gain
  13. * Outputs:
  14. *  PC     - Predictor coefficients
  15. *  *G2PASS - Excitation modification sharpening factor
  16. */
  17.  
  18. #include "config.ch"
  19. #include "lpcdefs.h"
  20. #include <math.h>
  21.  
  22. irc2pc( rc, pc, gprime, g2pass, where )
  23. float rc[MAXORD][11], pc[], gprime, *g2pass;
  24. int where;
  25. {
  26. int i,j;
  27. float temp[MAXORD];
  28.  
  29. *g2pass = 1.;
  30.  
  31. for(i=0;i<ORDER;i++)    
  32.     *g2pass = *g2pass*( 1. - rc[i][where]*rc[i][where] );
  33.  
  34. *g2pass = gprime*sqrt(*g2pass);
  35. pc[0] = rc[0][where];
  36.  
  37. for(i=1;i<ORDER;i++)    {
  38.     for(j=0;j<i;j++)
  39.         temp[j] = pc[j] - rc[i][where]*pc[i-j-1];
  40.     
  41.     for(j=0;j<i;j++)
  42.         pc[j] = temp[j];
  43.     
  44.     pc[i] = rc[i][where];
  45. }
  46.  
  47. }
  48.